$(function(){

	$("#createManager").click(function(){
		tb_show("添加企业负责人", "/person/create?keepThis=true&TB_iframe=true&height=530&width=600", "thickbox");
		returnid = "#manager\\.id";
		 
	});

	$("#createIncorporator").click(function(){
		tb_show("添加企业法人", "/person/create?keepThis=true&TB_iframe=true&height=530&width=600", "thickbox");
		returnid = "#incorporator\\.id";
		 
	}); 
 
 

	$("#searchManager").click(function(){
		tb_show("查找企业负责人", "/person/search?keepThis=true&TB_iframe=true&height=530&width=600", "thickbox");
		returnid = "#manager\\.id";
	});
 

	$("#searchIncorporator").click(function(){
		tb_show("查找企业法人", "/person/search?keepThis=true&TB_iframe=true&height=530&width=600", "thickbox");
		returnid = "#incorporator\\.id";
	}); 
 
  
	$("#deleteManager").click(function(){  
		$("#manager\\.id").empty();
		$(this).after("<input type='hidden' id='manager' name='manager' value=''>");
 	}); 


 	$("#deleteIncorporator").click(function(){  
		$("#incorporator\\.id").empty();
		$(this).after("<input type='hidden' id='incorporator' name='incorporator' value=''>");
 	}); 

});

function save(id, name){
	$(returnid).empty();
	var opt = "<option value="+id+ ">" + name
	$(returnid).prepend(opt);
	returnid = returnid.replace("\\.id" , "");
	//alert(returnid);
	$(returnid).remove();
}

var returnid = '';